<?php
  class User_model extends CI_Model {

    function __construct()
    {
        parent::__construct();
    }
      
    //根据ID获取一条记录
    function get_user_by_id_one($id)
    {
    	return $this->db->from('crazy_admin')->where('id',$id)->get()->row();
    }
    
    //删除 
    function get_user_del($id)
    {
    	$this->db->where('id', $id);
    	$this->db->delete('crazy_admin');
    }
	
	
	 //新增
    function user_save_add($data)
    {
    	$this->db->insert('crazy_admin', $data);
    }
    
    //编辑
    function user_save_modify($id,$data)
    {
    	$this->db->where('id', $id);
    	$this->db->update('crazy_admin', $data);
    }
	
	
    function get_full_user_by_username( $username = '' )
    {
       return $this->db->from('crazy_admin')->where('userid',$username)->get()->row();
    }
  
   
         //编辑
        function admin_modify($id,$data)
        {
            $this->db->where('id', $id);
            $this->db->update('crazy_admin', $data); 
        }
    
}

?>
